/* Copyright (C) 2008 Ryan Capote
 * This file is apart of Blue Engine
 * See Licesnse.txt
 */

#ifndef VIDEODRIVER_H_
#define VIDEODRIVER_H_

#include <SDL.h>
#include <SDL_opengl.h>
#include <string>
#include "../utils/utils.h"

namespace BlueEngine
{
    namespace Video
    {
	/**
	 * The video class which handles the rendering.
	 */
	class VideoDriver
	{
	   public:

	    /**
	     * Constructor
	     */
	    VideoDriver();

	    /**
	     * Deconstructor
	     */
	    ~VideoDriver();

	    /**
	     * Creates the window
	     * @param fullscreen Toggles fullscreen
	     * @param width The width of the screen
	     * @param height The height of the screen
	     * @param caption The caption of the window
	     */
	    bool setVideoMode(bool fullscreen, int width, int height, int bits);

	    /**
	     * getWidth
	     * @return The screen's width
	     */
	    int getWidth();

	    /**
	     * getHeight
	     * @return The screen's height
	     */
	    int getHeight();

	    /**
	     * isFullscreen
	     * @return Whether we are fullscreen or not
	     */
	    bool isFullscreen();

	    /**
	     * setCaption
	     * Sets the caption of the window
	     * @param caption The caption of the window.
	     */
	    void setCaption( std::string caption );

	    /**
	     * setBlend
	     * Toggles blending
	     * @param blending Sets whether blending is off or on.
	     */
	    void setBlend(bool blending);

	    /**
	     * clip
	     * Clip the screen and only render to the specified 
	     * part of the screen.
	     */
	    void clip(int x, int y, int width, int height);
            void clip(Utilities::Rect clipBox);

	    /**
	     * resetClip
	     * Resets the clip.
	     */
	    void resetClip();

	    /**
	     * beginScene
	     * This is called before rendering the scene.
	     */
	    void beginScene();

	    /**
	     * endScene
	     * This is called after we are done rendering the scene.
	     */
	    void endScene();

	    private:

	    /**
	     * This is where everything gets rendered to.
	     */
	    SDL_Surface*    m_screen;

	    int		    m_width;
	    int		    m_height;
	    bool	    m_fullscreen;

	};
    }
}

#endif
